import {createApp} from 'vue';
import App from './App.vue';
//引入路由
import router from '@/router/index';
//引入仓库
import pinia from './store'

// 引入element-plus插件与样式
import ElementPlus from 'element-plus'
// 引入Element样式
import 'element-plus/dist/index.css'
// 引入暗黑模式样式
import 'element-plus/theme-chalk/dark/css-vars.css'
// 配置element-plus国际化
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import myConfirm from "@/utils/myConfirm.ts";
// 按钮权限
import {permission} from "@/directive/permissions.ts";
// 引入模版的全局样式
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 引入模版的全局样式
import '@/styles/index.scss'

const app = createApp(App);
// 注册element-plus
app.use(ElementPlus, {
    locale: zhCn,
})
app.directive('permission',permission)
//安装仓库
app.use(pinia)
//安装路由
app.use(router)
import './permisson.ts'
app.mount('#app');

// 全局注册图标组件element-plus 的所有 ico
app.config.globalProperties.$icons = []
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.config.globalProperties.$icons.push(key)
    app.component(key, component);
}

// 全局挂载
app.config.globalProperties.$myConfirm = myConfirm
